<?php

namespace app\common\model;

use think\Model;

class Admin extends Model
{
    //
    public function login($data){
        $result = $this->where($data)->find();
        if($result){
            if ($result['status'] != 1) {
                return '此账户被禁用';
            }
            $session = [
                'id'       => $result['id'],
                'nickname' => $result['nickname'],
            ];
            session('admin', $session);
            return 1;
        }else{
            return 0;
        }
    }
}
